﻿#ifndef LOCALDEV_H
#define LOCALDEV_H
#include <QString>
#include <QVector>
#include "motor.h"
#include "hmi.h"

typedef struct localCmd_s
{
    quint16 cmd;
    float x;
    float y;
    float z;
}localCmd_t;

typedef struct localDns_s
{
    float m_01;
    float m_02;
    float m_03;
    float m_04;
    float m_05;
    float m_06;
    float m_07;
    float m_08;
    float m_09;
    float m_10;
    float m_11;
    float m_12;
    float m_13;
    float m_14;
    float m_21;
    float m_22;
    float m_23;
    float m_24;
    float m_25;
    float m_26;
    float latitude;
    float longitude;
    float elevation;
}localDna_t;

typedef struct motorSetValue_s
{
    bool enable;
    float power;
    float trip;
    float speed;
    int type;
}motorSetValue_t;

class LocalDev
{
public:
    QVector<Motor> m_motor;
    motorSetValue_t m_motorSet[2];

    LocalDev(void);

    int busID() const;
    void setBusID(int busID);

    int offset() const;
    void setOffset(int offset);

    QString hwVer() const;
    void setHwVer(const QString &hwVer);

    QString swVer() const;
    void setSwVer(const QString &swVer);

    QString uid() const;
    void setUid(const QString &uid);

    QString swbTime() const;
    void setSwbTime(const QString &swbTime);

    int row() const;
    void setRow(int row);

    int col() const;
    void setCol(int col);

    int sector() const;
    void setSector(int sector);

    int hcdi() const;
    void setHcdi(int hcdi);

    double getLongitude() const;
    void setLongitude(double value);

    double getLatitude() const;
    void setLatitude(double value);

    double getAltitude() const;
    void setAltitude(double value);

    Hmi getHmi() const;
    void setHmi(const Hmi &hmi);

    int getBaudrate() const;
    void setBaudrate(int baudrate);

    int getLogLevel() const;
    void setLogLevel(int logLevel);

    QString getSn() const;
    void setSn(const QString &sn);

    QString getSMAddr() const;
    void setSMAddr(const QString &sMAddr);

    QString getMAddr() const;
    void setMAddr(const QString &mAddr);

    localCmd_t getCmd() const;
    void setCmd(const localCmd_t &cmd);

    localDna_t getDna() const;
    void setDna(const localDna_t &dns);

private:
    Hmi m_hmi;
    localCmd_t m_cmd;
    localDna_t m_dns;

    QString m_sn;

    int m_busID;     // 总线id
    int m_offset;    // 偏移量
    QString m_mAddr; // modbus地址
    int m_baudrate;
    QString m_sMAddr;

    QString m_hwVer;
    QString m_swVer;
    QString m_uid;
    QString m_swbTime;
    int m_logLevel;

    int m_row;
    int m_col;
    int m_sector;
    int m_hcdi;

    double longitude;
    double latitude;
    double altitude;
};

#endif // LOCALDEV_H
